home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!user
- From: 101641.317@compuserve.com (Martin Mamo)
- Newsgroups: comp.lang.c
- Subject: Why are &apple and apple, where apple is an array, the same
- Date: Thu, 18 Apr 1996 23:08:25 +0000
- Organization: none
- Distribution: world
- Message-ID: <AD9C7BE9966828AF7@ad49-131.compuserve.com>
- NNTP-Posting-Host: ad49-131.compuserve.com
-
- The following C program contains two printf's. They both
- give the same answer, despite the fact one gives the
- value of apple and the other &apple.
-
- I know in C, an array variable is the address of the
- first element. So why do C compilers on both Macs and PCs
- allow you to take an address of an address? Why does
- apple and &apple, where apple is an array variable, give
- the same result.
-
- Please can you reply by e-mail to me as well, as I check
- newsgroups less often than my e-mail. Thanks.
-
- Martin
- 101641.317@compuserve.com
-
-
- #include <stdio.h>
-
- void main(void)
- {
-
- char apple[10];
- apple[0] = 0;
-
- printf( "%lu\n", apple );
-
- printf(" %lu\n", &apple );
-
-
- }
-
-
-
-